## Replication files for "Ministerial Autonomy, Paliamentary Scrutiny and Government reform Output in Parliamentary Democracies
## Authors: Hanna Bäck, Wolfgang C. Müller, Mariyana Angelova, Daniel Strobl
## Corresponding author: Mariyana Angelova - angelova@ceu.edu
## 15.01.2021

## This script creates figure 1 and 2
## Figure 1: Ministerial Autonomy vs. Policy-by-Policy Compromise
## Figure 2: Ministerial Drift

##install.packages("plotrix")
library("plotrix")

## set working directory
setwd("~/Desktop/Replication files")
##===============================================================
## Figure 1: Ministerial Autonomy vs. Policy-by-policy Compromise
##===============================================================


## set colors
colA<-"gray60"
colB<-"black"
colG<-"gray10"

## circle coordinates
x1=3.5
y1=4
x2=y2=6

pdf(file="figure1.pdf",width=14,height=6,paper='special') 

##===============================================================
## Left plot: ministerial autonomy
##===============================================================
par(mfrow=c(1,2))
plot(1, type="n", xlab="", ylab="", xlim=c(0, 10), ylim=c(0, 10), las=1, asp=1, xaxt = 'n', yaxt = 'n', bty="n" )
## indiference curves
draw.circle(x1, y1, 2.5, nv = 1000, border=colA, lty = 1, lwd = 1)
draw.circle(x2, y2, 3, nv = 1000, border = colB, lty = 1, lwd = 1)
segments(x1,0,x1,10, col="gray60", lty=3)
segments(0,y2,10,y2, col="gray60", lty=3)

arrows(0,0,10,0, col=colA)
arrows(0,0,0,10, col=colB)
mtext(side=1, line=1.5, at=9,text="Ministry of\nEconomic Affairs", cex=1.2, col=colA)
mtext(side=2, line=3.8, at=9,text="Ministry of\nSocial Affairs", cex=1.2, las=1,col=colB, adj=0)

## Party A position
points(x1,y1, pch=19, cex=1, col=colA)
text(x1-1,y1, labels="Party A", cex=1.2, col=colA)

## Party B position
points(x2,y2, pch=19, cex=1, col=colB)
text(x2+1,y2+0.4, labels="Party B", cex=1.2, col=colB)

## SQ position
text(2.5,7, labels="SQ", col="gray40", cex=1.2)
points(3.05,6.45, pch=19, col="gray40", cex=1)

## AB position: government outcome under ministerial autonomy
points(x1,y2, pch=4, col=colG, cex=1.2, lwd=1.5)
text(x1+0.3,y2-0.4, labels="AB", col=colG, cex=1.2)

##===============================================================
## Righ plot: coalition compromise
##===============================================================

plot(1, type="n", xlab="", ylab="", xlim=c(0, 10), ylim=c(0, 10), las=1, asp=1, xaxt = 'n', yaxt = 'n', bty="n" )
segments(x1+1,0,x1+1,10, col=colB, lty=3)
segments(0,y2-1,10,y2-1, col=colB, lty=3)

## lines for ministerial autonomy intersection
segments(x1,0,x1,10, col="gray90", lty=3)
segments(0,y2,10,y2, col="gray90", lty=3)

## x and y axis
arrows(0,0,10,0, col=colA)
arrows(0,0,0,10, col=colB)

## axis labels
mtext(side=1, line=1.5, at=9,text="Ministry of\nEconomic Affairs", cex=1.2, col=colA)
mtext(side=2, line=3.8, at=9,text="Ministry of\nSocial Affairs", cex=1.2, las=1,col=colB, adj=0)

## indiference curves
draw.circle(x1, y1, 2, nv = 1000, border=colA, lwd = 1, lty=1)
draw.circle(x2, y2, 2.5, nv = 1000, border = colB, lty = 1, lwd = 1)

## arrows towards comrpomise position
arrows(x1,y1,x1+1,y1, col=colB, lty=1, length=0.15)
arrows(x2,y2,x2,y2-1, col=colB, length=0.15)

## Party A position
points(x1,y1, pch=19, cex=1, col=colA)
text(x1-1,y1, labels="Party A", cex=1.2, col=colA)

## Party B position
points(x2,y2, pch=19, cex=1, col=colB)
text(x2+1,y2+0.4, labels="Party B", cex=1.2, col=colB)

## SQ position
text(2.5,7, labels="SQ", col="gray40", cex=1.2)
points(3.05,6.45, pch=19, col="gray40", cex=1)

## AB position: government outcome under ministerial autonomy
points(x1,y2, pch=4, col=colG, cex=1.2, lwd=1.5)
text(x1+0.3,y2-0.4, labels="AB", col=colG, cex=1.2)

## CC position: politcy-by-policy compromise
points(x1+1,y2-1, pch=4, col="black", cex=1.2, lwd=1.5)
text(x1+1,y2-1.4, labels="CC", col=colG, cex=1.2)

dev.off()





##===============================================================
## Figure 2: Ministerial Drift
##===============================================================


pdf(file="figure2.pdf",width=14,height=6,paper='special') 

##=========================================================
## Left plot: Party A defects from the coalition compromise
##=========================================================

par(mfrow=c(1,2))
plot(1, type="n", xlab="", ylab="", xlim=c(0, 10), ylim=c(0, 10), las=1, asp=1, xaxt = 'n', yaxt = 'n', bty="n", main="Party A defects from the coaliition compromise" )

arrows(0,0,10,0, col=colA)
arrows(0,0,0,10, col=colB)
mtext(side=1, line=1.5, at=9,text="Ministry of\nEconomic Affairs", cex=1.2, col=colA)
mtext(side=2, line=3.8, at=9,text="Ministry of\nSocial Affairs", cex=1.2, las=1,col=colB, adj=0)
segments(x1,0,x1,10, col="gray90", lty=3)
segments(0,y2,10,y2, col="gray90", lty=3)

## Party A position
arrows(x1,y1,x1+1,y1, col="gray85", lty=1, length=0.15)

points(x1,y1, pch=19, cex=1, col=colA)
text(x1-1,y1, labels="Party A", cex=1.2, col=colA)

## Party B position
arrows(x2,y2,x2,y2-1, col=colB, length=0.15)
points(x2,y2, pch=19, cex=1, col=colB)
text(x2+1,y2+0.4, labels="Party B", cex=1.2, col=colB)

## SQ positiomn
text(2.5,7, labels="SQ", col="gray40", cex=1.2)
points(3.05,6.45, pch=19, col="gray40", cex=1)

## draw indiference curves
draw.circle(x1, y1, 2, nv = 1000, border=colA, lwd = 1, lty=1)
draw.circle(x2, y2, 2.5, nv = 1000, border = colB, lty = 1, lwd = 1)

## AB position: government outcome under ministerial autonomy
points(x1,y2, pch=4, col="black", cex=1.2, lwd=1.5)
text(x1+0.3,y2-0.4, labels="AB", col=colG, cex=1.2)

## CC position: politcy-by-policy compromise
points(x1+1,y2-1, pch=4, col="black", cex=1.2, lwd=1.5)
text(x1+1,y2-1.4, labels="CC", col="black", cex=1.2)

## Party A does not compromise
points(x1,y2-1, pch=13, col=colG, cex=1.2, lwd=1.5 )
text(x1,y2-1.4, labels="AC", col=colG, cex=1.2)
segments(0,y2-1,10,y2-1, col=colB, lty=3)

##===============================================================
## Left plot: Party B defects from the coalition compromise
##===============================================================

plot(1, type="n", xlab="", ylab="", xlim=c(0, 10), ylim=c(0, 10), las=1, asp=1, xaxt = 'n', yaxt = 'n', bty="n", main="Party B defects from the coalition compromise" )

arrows(0,0,10,0, col=colA)
arrows(0,0,0,10, col=colB)
mtext(side=1, line=1.5, at=9,text="Ministry of\nEconomic Affairs", cex=1.2, col=colA)
mtext(side=2, line=3.8, at=9,text="Ministry of\nSocial Affairs", cex=1.2, las=1,col=colB, adj=0)
segments(x1,0,x1,10, col="gray90", lty=3)
segments(0,y2,10,y2, col="gray90", lty=3)

## Party A position
arrows(x1,y1,x1+1,y1, col=colB, lty=1, length=0.15)
points(x1,y1, pch=19, cex=1, col=colA)
text(x1-1,y1, labels="Party A", cex=1.2, col=colA)

## Party B position
arrows(x2,y2,x2,y2-1, col="gray85", length=0.15)
points(x2,y2, pch=19, cex=1, col=colB)
text(x2+1,y2+0.4, labels="Party B", cex=1.2, col=colB)

## SQ position
text(2.5,7, labels="SQ", col="gray40", cex=1.2)
points(3.05,6.45, pch=19, col="gray40", cex=1)

## Draw indiference curves
draw.circle(x1, y1, 2, nv = 1000, border=colA, lwd = 1, lty=1)
draw.circle(x2, y2, 2.5, nv = 1000, border = colB, lty = 1, lwd = 1)

## ministerial autonomy
points(x1,y2, pch=4, col="black", cex=1.2, lwd=1.5)
text(x1+0.3,y2-0.4, labels="AB", col=colG, cex=1.2)

## CC position: politcy-by-policy compromise
points(x1+1,y2-1, pch=4, col="black", cex=1.2, lwd=1.5)
text(x1+1,y2-1.4, labels="CC", col="black", cex=1.2)

## Party B does not compromises
segments(x1+1,0,x1+1,10, col=colB, lty=3)
points(x1+1,y2, pch=13, col=colG, cex=1.2, lwd=1.5)
text(x1+1.5,y2, labels="CB", col=colB, cex=1.2)

dev.off()





